package com.hotel.tv.application.serializer;

import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.serializer.LongCodec;

import java.lang.reflect.Type;

/**
 * 自定义转换器
 * <p>
 * </p>
 *
 * @description TODO
 * @author: 老码农
 * @create: 2020-04-15 13:24
 **/
public class CustomLongCodec extends LongCodec {

    public static CustomLongCodec CUSTOM_INSTANCE = new CustomLongCodec();

    @Override
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        try {
            return super.deserialze(parser, clazz, fieldName);
        } catch (Exception err) {
            throw new JSONException("解析出错, 字段 : " + fieldName);
        }
    }
}
